คือผมจะทำ Ecel Login เข้าสู่ระบบ Stock แล้วผมได้ยึดฐานข้อมูล Username และ Password คือ Microsoft Access เป็นฐานข้อมูลในการใส่ Username
พอผม Run Code แล้วทุกอย่างได้หมด เว้น เวลาใส่รหัสผิดก็ยังเข้าสู่ระบบได้ รบกวนช่วยผมหรือแนะนำผมหน่อยครับ
Option Explicit
Private Sub btn_Clear_Click()
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
End Sub
Private Sub btn_Login_Click()
If Me.TextBox1.Value = "" Then
MsgBox "Please enter the user id", vbCritical
Exit Sub
End If
If Me.TextBox2.Value = "" Then
MsgBox "Please enter the password", vbCritical
Exit Sub
End If
Call User_Login(Me.TextBox1.Value, Me.TextBox2.Value)
Unload Me
End Sub
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then Call btn_Login_Click
End Sub
Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then Call btn_Login_Click
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "Please enter your Username and Password to Login", vbCritical
End If
End Sub
Excel Login แล้วใส่รหัสผิดยังเข้าสู่ระบบได้
พอผม Run Code แล้วทุกอย่างได้หมด เว้น เวลาใส่รหัสผิดก็ยังเข้าสู่ระบบได้ รบกวนช่วยผมหรือแนะนำผมหน่อยครับ
Option Explicit
Private Sub btn_Clear_Click()
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
End Sub
Private Sub btn_Login_Click()
If Me.TextBox1.Value = "" Then
MsgBox "Please enter the user id", vbCritical
Exit Sub
End If
If Me.TextBox2.Value = "" Then
MsgBox "Please enter the password", vbCritical
Exit Sub
End If
Call User_Login(Me.TextBox1.Value, Me.TextBox2.Value)
Unload Me
End Sub
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then Call btn_Login_Click
End Sub
Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then Call btn_Login_Click
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "Please enter your Username and Password to Login", vbCritical
End If
End Sub